package org.gwu.seuss.client.commandline;

import org.gwu.seuss.communication.util.PasswordPrompt;
import org.gwu.seuss.ui.commandline.BaseCommandLineArgs;
import org.kohsuke.args4j.Option;

public class CommandLineArgs extends BaseCommandLineArgs {

	@Option(name = "-u", aliases = "-upload", usage = "filename to upload")
	private String upload;

	@Option(name = "-ui", usage = "if uploading existing, fileid of file")
	private String uploadId;

	@Option(name = "-d", aliases = "-download", usage = "fileId to download")
	private String download;

	@Option(name = "-f", usage = "display file names that belong to user")
	private boolean fileList = false;

	@Option(name = "-up", usage = "update password value")
	private boolean updatePassword = false;

	@Option(name = "-df", usage = "filename to delete")
	private String deleteFile;

	@Option(name = "-un", usage = "update name")
	private String newEmail;

	@Option(name = "-s", usage = "share fileid")
	private String shareFileId;

	@Option(name = "-su", usage = "username to share with")
	private String shareUsername;

	@Option(name = "-sp", usage = "upload, download, remove (permissions)")
	private String sharePermissions;

	public String getSharePermissions() {
		return sharePermissions;
	}

	public void setSharePermissions(String sharePermissions) {
		this.sharePermissions = sharePermissions;
	}

	private char[] retrievedPassword = null;

	public String getShareFileId() {
		return shareFileId;
	}

	public void setShareFileId(String shareFileId) {
		this.shareFileId = shareFileId;
	}

	public String getShareUsername() {
		return shareUsername;
	}

	public void setShareUsername(String shareUsername) {
		this.shareUsername = shareUsername;
	}

	public String getUploadId() {
		return uploadId;
	}

	public void setUploadId(String uploadId) {
		this.uploadId = uploadId;
	}

	public String getDeleteFile() {
		return deleteFile;
	}

	public void setDeleteFile(String deleteFile) {
		this.deleteFile = deleteFile;
	}

	public boolean isUpdatePassword() {
		return updatePassword;
	}

	public char[] retrievePassword() {

		if (retrievedPassword == null) {
			retrievedPassword = PasswordPrompt
					.askForPassword("Please enter new password");
		}
		return retrievedPassword;
	}

	public void canUpdatePassword(boolean newPassword) {
		this.updatePassword = newPassword;
	}

	public String getUpload() {
		return upload;
	}

	public void setUpload(String upload) {
		this.upload = upload;
	}

	public String getDownload() {
		return download;
	}

	public void setDownload(String download) {
		this.download = download;
	}

	public boolean isFileList() {
		return fileList;
	}

	public void setFileList(boolean fileList) {
		this.fileList = fileList;
	}

	public String getNewEmail() {
		return newEmail;
	}

	public void setNewEmail(String newEmail) {
		this.newEmail = newEmail;
	}

}
